define([
    "ngController"
],function (appAngular) {

    // 底部按钮先关-可拖动模块-6、标注
    appAngular.directive("bimApiModelSign", function () {
        return {
            restrict: "EA",
            replace: true,
            template: `<div class="draggable model-sign" 
                            style="display: {{(btnsSelect.name=='sign'&&btnsSelect.check == true)?'block':'none'}}">
						<input type="text" placeholder="输入标题" ng-model="modelSign.name">
						<textarea placeholder="输入备注信息" rows="4" maxlength="50" ng-model="modelSign.comment"></textarea>
						<div class="sign-color">
							<span>选择标记颜色：</span>
							<div class="sign-color-content">
								<div ng-repeat="color in modelSign.color" 
									class="sign-color-index {{modelSign.colorIndex==color?'sign-color-active':null}}" 
									ng-click="modelChooseColorIndex(modelSign, color)">
									<span style="background-color: {{color}}"></span>
								</div>
							</div>
						</div>
						<div class="sign-btn">
							<button>保存</button>
							<button ng-click="modelDragTitleClose(); Model.singerCancal()">取消</button>
						</div>
					</div>`,
            link: function ($scope, $elem, attrs) {
                // 模型中-6-标注属性
                $scope.modelSign = {
                    name: '',
                    comment: '',
                    color: ['#f65f74', '#9c4de6', '#3565ed', '#4ed390', '#f39846'],
                    colorIndex: '#f65f74'
                };
                $elem.on("click", function (e) {
                    if (e.target.localName == "textarea") {
                        $elem[0].children[1].focus();
                    }
                });
            }
        };
    });

    return appAngular;
});